<?php
// +----------------------------------------------------------------------
// | ThinkPHP [ WE CAN DO IT JUST THINK ]
// +----------------------------------------------------------------------
// | Copyright (c) 2006~2018 http://thinkphp.cn All rights reserved.
// +----------------------------------------------------------------------
// | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 )
// +----------------------------------------------------------------------
// | Author: liu21st <liu21st@gmail.com>
// +----------------------------------------------------------------------
use think\facade\Route;

/**
 * 说明
 * --------------------------------------------------------------------------------------+
 * 1. middleware('check') 后台登录验证中间件
 * 2. middleware('auth') 前台登录验证中间件
 * --------------------------------------------------------------------------------------+
 */
    Route::get('captcha/[:id]', "\\think\\captcha\\CaptchaController@index");
    Route::rule('/', 'index/index');   // 前台首页
    
    $controllerRoute = get_config('group_navbar.make_module');
        // // 后台访问路由
        foreach (trim_array_element($controllerRoute) as $key => $val) { 

      // 管理员路由组
            
    $actionRoute = get_config('user_code.make_module');

        foreach (trim_array_element($actionRoute) as $key => $value) { 
           
        if ( $val == 'user' && $value == 'index' || $value == 'store' || $value == 'signin' || $value == 'detail' || $value == 'logout' || $value == 'profile' || $value == 'change'  || $value == 'lottery' || $value == 'chat' ) {

     Route::any('' . $val . '/' . $value.'', '' . $val . '/' . $value. '')->middleware('auth'); 
                
                 } else { // 列表+详情模型

     Route::any('' . $val . '/' . $value.'', '' . $val . '/' . $value. ''); // 后台登录访问路由
                  
                  }
               }  
            }
     // 屏蔽恶意请求路由
      Route::miss(function (){ return redirect('/404.html'); });